Skip to content

Conversation

@cgitr
Copy link

@cgitr cgitr commented Jun 15, 2012

We had a constant loading problem in our application.

Because VERSION was nested somewhere under ActiveRecord::ConnectionAdapters and this file was required in the .gemspec, the ActiveRecord autoloading of the ConnectionHandler was not triggered when loading ActiveRecord for the first time.

Result:

.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:82:in `<class:Base>': uninitialized constant ActiveRecord::ConnectionAdapters::ConnectionHandler (NameError)
    from /Users/cr/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:2:in `<module:ActiveRecord>'
    from /Users/cr/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:1:in `<top (required)>'
    from /Users/cr/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/base.rb:720:in `<top (required)>'

Regards
Chris

@metaskills
Copy link
Member

You need to start off another topic branch or id your pull request for that commit only. It now has the commits from your other pull request too. I'll just handle it this side, after looking at it.

@metaskills
Copy link
Member

BTW, it's a good idea to turn off your personal white space settings when making commits too. It's not that I disagree, but you want your request to be only for what you need.

Before the VERSION constant was defined in an AR namespace,
which confused some of rails autoloading code. we should define
the Version in a namespace, which the gem owns to prevent such conflicts.
@cgitr
Copy link
Author

cgitr commented Jun 15, 2012

@metaskills Sorry about that! Corrected...

@metaskills
Copy link
Member

Thanks! This makes it really easy for me to see what is going on.

@metaskills
Copy link
Member

Hmmm, we are technically in the ActiveRecord namespace since we are an extension to that gem. Is there another way this issue could be fixed? Perhaps adding another line under require 'active_record/connection_adapters/abstract_adapter' in the sqserver_adapter.rb file? I would like to avoid making our own namespace since we technically do not have one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants